/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.subway.persistencias;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Héctor <UFG>
 */
@Entity
@Table(name = "empleado", catalog = "bd_subway", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Empleado.findAll", query = "SELECT e FROM Empleado e"),
    @NamedQuery(name = "Empleado.findByEmpId", query = "SELECT e FROM Empleado e WHERE e.empId = :empId"),
    @NamedQuery(name = "Empleado.findByEmpSueldo", query = "SELECT e FROM Empleado e WHERE e.empSueldo = :empSueldo"),
    @NamedQuery(name = "Empleado.findByEmpFechaIngreso", query = "SELECT e FROM Empleado e WHERE e.empFechaIngreso = :empFechaIngreso")})
public class Empleado implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "empId")
    private Integer empId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "empSueldo", nullable = false)
    private double empSueldo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "empFechaIngreso", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date empFechaIngreso;
    @JoinColumn(name = "empPaisId", referencedColumnName = "paisId", nullable = false)
    @ManyToOne(optional = false)
    private CatPais empPaisId;
    @JoinColumn(name = "empSucursalId", referencedColumnName = "sucId", nullable = false)
    @ManyToOne(optional = false)
    private Sucursal empSucursalId;
    @JoinColumn(name = "empPersonaId", referencedColumnName = "personaId", nullable = false)
    @ManyToOne(optional = false)
    private Persona empPersonaId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "entPEmpleadoId")
    private List<ProdEntrega> prodEntregaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pedEmpId")
    private List<Pedido> pedidoList;

    public Empleado() {
    }

    public Empleado(Integer empId) {
        this.empId = empId;
    }

    public Empleado(Integer empId, double empSueldo, Date empFechaIngreso) {
        this.empId = empId;
        this.empSueldo = empSueldo;
        this.empFechaIngreso = empFechaIngreso;
    }

    public Integer getEmpId() {
        return empId;
    }

    public void setEmpId(Integer empId) {
        this.empId = empId;
    }

    public double getEmpSueldo() {
        return empSueldo;
    }

    public void setEmpSueldo(double empSueldo) {
        this.empSueldo = empSueldo;
    }

    public Date getEmpFechaIngreso() {
        return empFechaIngreso;
    }

    public void setEmpFechaIngreso(Date empFechaIngreso) {
        this.empFechaIngreso = empFechaIngreso;
    }

    public CatPais getEmpPaisId() {
        return empPaisId;
    }

    public void setEmpPaisId(CatPais empPaisId) {
        this.empPaisId = empPaisId;
    }

    public Sucursal getEmpSucursalId() {
        return empSucursalId;
    }

    public void setEmpSucursalId(Sucursal empSucursalId) {
        this.empSucursalId = empSucursalId;
    }

    public Persona getEmpPersonaId() {
        return empPersonaId;
    }

    public void setEmpPersonaId(Persona empPersonaId) {
        this.empPersonaId = empPersonaId;
    }

    @XmlTransient
    public List<ProdEntrega> getProdEntregaList() {
        return prodEntregaList;
    }

    public void setProdEntregaList(List<ProdEntrega> prodEntregaList) {
        this.prodEntregaList = prodEntregaList;
    }

    @XmlTransient
    public List<Pedido> getPedidoList() {
        return pedidoList;
    }

    public void setPedidoList(List<Pedido> pedidoList) {
        this.pedidoList = pedidoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (empId != null ? empId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Empleado)) {
            return false;
        }
        Empleado other = (Empleado) object;
        if ((this.empId == null && other.empId != null) || (this.empId != null && !this.empId.equals(other.empId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        
        return "" + this.empPersonaId;
    }
    
}
